app.controller('yingjiyuan',['$scope','$http','$location','mainService',function ($scope,$http,$location,mainService) {
    var token = localStorage.getItem('token');
    mui.showLoading('正在加载','div');
    $http({
        method: "POST",
        url: mainUrl+'/em/em-plan!read4App.action',
        params: {
            'Authorization': token,
            'page':1,
            'start':0,
            'limit':99999

            /*'qm.flag' : 1*/
        }
    }).then(
        function(data, status, headers, config){
            console.log(data);
            $scope.item = data.data.items;
            mui.hideLoading();
        },function(data, status, headers, config){

        }
    );

    $scope.sousuo = function () {
        mui.showLoading('正在加载','div');
        $http({
            method: "POST",
            url: mainUrl+'/em/em-plan!read4App.action',
            params: {
                'Authorization': token,
                'page':1,
                'start':0,
                'limit':99999,
                'qm.planName': $scope.content

                /*'qm.flag' : 1*/
            }
        }).then(
            function(data, status, headers, config){
                console.log(data);
                $scope.item = data.data.items;
                mui.hideLoading();
            },function(data, status, headers, config){

            }
        );
    }
    $scope.yjyaData = function ($event) {
        if (mainService.getData().page == 'luru') {
            mainService.getData().yjyaData = $event;
            mainService.getData().yjya = $event.planName;
            console.log(mainService.getData())
            console.log(mainService.getData().dateInput)
            $location.path('/yinhuanluru')
        } else {
            mainService.getData().yjyaData = $event;
            mainService.getData().yjya = $event.planName;
            console.log(mainService.getData())
            console.log(mainService.getData().dateInput)
            $location.path('/liuzhuandaichuliyinhuanziye')
        }
    }
}]);